import { createRouter, createWebHistory } from 'vue-router';

import Home from '@/views/home/index.vue';

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'HomeIndex',
      component: Home,
      meta: {
        title: '内容管理系统',
      },
    },
  ],
});

router.afterEach((to) => {
  setTimeout(() => {
    window.document.title = to.meta.title ? (to.meta.title as string) : '页面仔';
  }, 0);
});

export default router;
